//
//  API.swift
//  RxZhihu
//
//  Created by vsccw on 2018/12/27.
//  Copyright © 2018 vsccw.com. All rights reserved.
//

import Foundation
import Moya
import RxSwift

enum API {
  case hot(Int)
}

extension API: TargetType {
  var baseURL: URL {
    return URL(string: "https://www.zhihu.com")!
  }
  
  var path: String {
    return "/api/v3/feed/topstory/hot-list-wx"
  }
  
  var method: Moya.Method {
    return Moya.Method.get
  }
  
  var sampleData: Data {
    return Data()
  }
  
  var task: Task {
    switch self {
    case .hot(let count):
      return Task.requestParameters(parameters: ["limit": count], encoding: JSONEncoding.default)
    }
  }
  
  var headers: [String: String]? {
    return ["Content-type": "application/json"]
  }
  
  
}
